package com.wondersgroup.framework.widget.taglib.form;

import com.wondersgroup.framework.widget.annotations.WidgetTagAttribute;
import com.wondersgroup.framework.widget.context.DefaultSettings;
import com.wondersgroup.framework.widget.validation.annotation.TagValidate;
import com.wondersgroup.framework.widget.validation.annotation.TypeValidate;
import javax.servlet.jsp.PageContext;

@TagValidate
public abstract class BaseInputTag extends AbstractFormTag {
	private String property;
	private String value;

	@TypeValidate
	private boolean disabled;

	@TypeValidate
	private boolean readOnly;
	private String width = DefaultSettings.get("widget.text.width");

	@TypeValidate
	private boolean autoWidth;
	private String label;
	private String cls;
	private int tabIndex;
	private String statusBarArray;
	private String toolBarArray;

	public String getToolBarArray() {
		return ((String) this.pageContext.getAttribute("toolBarArray"));
	}

	public void setToolBarArray(String paramString) {
		this.toolBarArray = paramString;
	}

	public String getStatusBarArray() {
		return ((String) this.pageContext.getAttribute("statusBarArray"));
	}

	public void setStatusBarArray(String paramString) {
		this.statusBarArray = paramString;
	}

	public String getProperty() {
		return this.property;
	}

	@WidgetTagAttribute(description = "表单交互时的元素名称", required = true)
	public void setProperty(String paramString) {
		this.property = paramString;
	}

	public String getValue() {
		return this.value;
	}

	@WidgetTagAttribute(description = "设定输入栏的初始值")
	public void setValue(String paramString) {
		this.value = paramString;
	}

	public boolean isDisabled() {
		return this.disabled;
	}

	@WidgetTagAttribute(description = "设定是否不可用，如果为true则不参与表单交互")
	public void setDisabled(boolean paramBoolean) {
		this.disabled = paramBoolean;
	}

	public boolean isReadOnly() {
		return this.readOnly;
	}

	@WidgetTagAttribute(description = "设定是否只读，如果为true则不能改变值")
	public void setReadOnly(boolean paramBoolean) {
		this.readOnly = paramBoolean;
	}

	public String getWidth() {
		return this.width;
	}

	@WidgetTagAttribute(description = "自定义组件宽度，默认为160")
	public void setWidth(String paramInt) {
		this.width = paramInt;
	}

	public boolean isAutoWidth() {
		return this.autoWidth;
	}

	@WidgetTagAttribute(description = "自动设置宽度")
	public void setAutoWidth(boolean paramBoolean) {
		this.autoWidth = paramBoolean;
	}

	public String getLabel() {
		return ((this.label != null) ? this.label : LabelTag.getFieldLabel(
				this.property, this.pageContext));
	}

	@WidgetTagAttribute(description = "标签文本")
	public void setLabel(String paramString) {
		this.label = paramString;
	}

	public String getCls() {
		return this.cls;
	}

	@WidgetTagAttribute(description = "额外的该控件的css样式定义")
	public void setCls(String paramString) {
		this.cls = paramString;
	}

	public int getTabIndex() {
		return this.tabIndex;
	}

	@WidgetTagAttribute(description = "定义控件Tab顺序")
	public void setTabIndex(int paramInt) {
		this.tabIndex = paramInt;
	}
}